#include <iostream>
#include <time.h>
#include <random>
#include <windows.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    srand((unsigned)time(nullptr));
    int** p;
    p = new int*[n];
    for(int i = 0;i < n;i++)
    p[i] = new int[n];
    for(int i = 0;i < n;i++)
    for(int j = 0;j < n;j++)
    p[i][j] = rand() % 100;
    int* a = new int[n];
    int* sum = new int[n];
    for(int i = 0;i < n;i++){
    a[i] = rand() % 100;
    sum[i] = 0;
    }
    LARGE_INTEGER t1,t2,tc;
    QueryPerformanceFrequency(&tc);
    QueryPerformanceCounter(&t1);
    /*
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++)
        {
            sum[i] += p[j][i] * a[j];
        }
    }*/
    //cache访问算法
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < n;j++)
        sum[j] += a[i] * p[i][j];
    }
    QueryPerformanceCounter(&t2);
    double time = 0;
    time=(double)(t2.QuadPart-t1.QuadPart)/(double)tc.QuadPart; 
    cout<<"time = "<<time<<endl;  //输出时间（单位：ｓ）
    return 0;
}